#include "handle.h"

#include <vector>

struct vector_handle {
    std::vector<int> v;
};

struct vector_handle *get_vector()
{
    return new struct vector_handle;
}

void vector_push_back_int(struct vector_handle *vector, int num)
{
    vector->v.push_back(num);
}

struct vector_itor_handle {
    std::vector<int>::iterator it;
};

struct vector_itor_handle *vector_begin(struct vector_handle *vector)
{
    auto vih = new struct vector_itor_handle;
    vih->it = vector->v.begin();
    return vih;
}

void vector_itor_next(struct vector_itor_handle *vih)
{
    vih->it++;
}

int vector_itor_deref(struct vector_itor_handle *vih)
{
    return *vih->it;
}

bool vector_end(struct vector_handle *vh, struct vector_itor_handle *vih)
{
    return vih->it == vh->v.end();
}
